#include "bits/stdc++.h"
using namespace std;
// 求序列中异或为0的序列方案数，设集合秩为r，则答案为2^(n-r)
// 需要进行rebuild进行消元
struct LinearBasis {
  using i64 = long long;
  LinearBasis() : zero_(false), has_rebuilded_(false) {
    memset(d_, 0, sizeof(d_));
    memset(nd_, 0, sizeof(nd_));
  }

  friend LinearBasis operator+(const LinearBasis& lhs, const LinearBasis& rhs) {
    LinearBasis t = lhs;
    for (int i = 62; i >= 0; i--) {
      if (rhs.d_[i]) {
        t.insert(rhs.d_[i]);
      }
    }
    return t;
  }

  void operator+=(const LinearBasis& rhs) {
    for (int i = 62; i >= 0; i--) {
      if (rhs.d_[i]) {
        this->insert(rhs.d_[i]);
      }
    }
  }
  
  void insert(i64 v) {
    for (int i = 62; i >= 0; i--) {
      if (!(v >> i & 1)) {
        continue;
      }
      if (d_[i]) {
        v ^= d_[i];
      } else {
        d_[i] = v;
        has_rebuilded_ = false;
        return;
      }
    }
    zero_ = true;
  }

  i64 queryMax() {
    i64 result = 0;
    for (int i = 62; i >= 0; i--) {
      if ((result ^ d_[i]) > result) {
        result ^= d_[i];
      }
    }
    return result;
  }

  i64 queryMin() {
    if (zero_) {
      return 0;
    }
    for (int i = 0; i <= 62; i++) {
      if (d_[i]) {
        return d_[i];
      }
    }
    return 0;
  }

  void rebuild() {
    memcpy(nd_, d_, sizeof(d_));

    for (int i = 1; i <= 62; i++) {
      for (int j = 0; j < i; j++) {
        if (nd_[i] >> j & 1) {
          nd_[i] ^= nd_[j];
        }
      }
    }
    has_rebuilded_ = true;
  }

  i64 queryKmin(i64 k) {
    k -= zero_;
    if (k <= 0) {
      return 0;
    }
    if (!has_rebuilded_) {
      rebuild();
    }
    i64 result = 0;
    for (int i = 0; i <= 62; i++) {
      if (nd_[i]) {
        if (k & 1) {
          result ^= nd_[i];
        }
        k >>= 1;
      }
    }
    if (k) {
      return -1;
    }
    return result;
  }

  i64 queryKmax(i64 k) {
    if (k <= 0) {
      return 0;
    }
    if (!has_rebuilded_) {
      rebuild();
    }
    i64 result = 0;
    for (int i = 62;i >= 0; i--) {
      if (nd_[i]) {
        if (k & 1) {
          result ^= nd_[i];
        }
        k >>= 1;
      }
    }
    if (k) {
      k -= zero_;
      return (k == 0 ? 0 : -1);
    }
    return result;
  }

  int getR() {
    rebuild();
    int r = 0;
    for (int i = 62; i >= 0; i--) {
      if (d_[i]) {
        r++;
      }
    }
    return r;
  }

  bool exist(i64 x) {
    for(int i = 62;i >= 0;i--) {
      if(x >> i & 1) {
        x ^= d_[i];
      }
      if(!x) {
        return true;
      }
    }
    return false;
  }
  bool zero_, has_rebuilded_;
  i64 d_[64], nd_[64];
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  LinearBasis lb;
  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    lb.insert(x);
  }
  lb.rebuild();
  for (int i = 0; i <= 62; i++) {
    cout << lb.nd_[i] << ' ';
  }
  return 0;
}